<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <p class="foo hg"></p>
    <script>
        if(document.querySelector('p').classList.contains("hg")){
            console.log('good');
        }else{
            console.log("no");
        }
    </script>
  </body>
</html>
